package com.zy.cat.entity.pdd;

import java.io.Serializable;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.zy.cat.common.utils.TJKUtils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 
 * @info 拼多多授权信息实体类
 * @author Link
 * @date 2019-09-10 15:06
 */
@ApiModel("拼多多授权信息实体类")
@Data
public class PddAccessToken implements Serializable {

	private static final long serialVersionUID = 134548734523L;
	
	@JsonProperty("scope")
	@ApiModelProperty(value = "授权接口范围", example = "[]")
	private List<String> scope;
	
	@JsonProperty("access_token")
	@ApiModelProperty(value = "access_token", example = "30fad6e986974f24a93ae662fd06ae3c6a13c256")
	private String accessToken;
	
	@JsonProperty("expires_in")
	@ApiModelProperty(value = "access_token过期时间（秒）", example = "15551529")
	private String expiresIn;
	
	@JsonProperty("expires_at")
	@ApiModelProperty(value = "access_token过期具体时间", example = "2020-05-02 13:43:52")
	private String expiresAt;
	
	@JsonProperty("refresh_token_expires_in")
	@ApiModelProperty(value = "refresh_token过期时间（秒）", example = "15551529")
	private long refreshTokenExpiresIn;

	@JsonProperty("refresh_token_expires_at")
	@ApiModelProperty(value = "refresh_token过期具体时间", example = "2020-05-02 13:43:52")
	private String refreshTokenExpiresAt;
	
	@JsonProperty("refresh_token")
	@ApiModelProperty(value = "refresh_token", example = "939f719917d44924b53e5276427879cdeee717f3")
	private String refreshToken;
	
	@JsonProperty("owner_id")
	@ApiModelProperty(value = "授权成功的账户ID", example = "9096250")
	private String ownerId;
	
	@JsonProperty("owner_name")
	@ApiModelProperty(value = "授权成功的账户名称", example = "17009243682")
	private String ownerName;

	public void setExpiresAt(long expiresAt) {
		this.expiresAt = TJKUtils.UnixToDateTime("", expiresAt*1000l);
	}

	public void setRefreshTokenExpiresAt(long refreshTokenExpiresAt) {
		this.refreshTokenExpiresAt = TJKUtils.UnixToDateTime("", refreshTokenExpiresAt*1000l);;
	}
}